package com.test.threads.example01;

public class TraditionalThread {
    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread();
        Thread.sleep(20000L);
        thread.start();

        Thread thread1 = new Thread(){
            @Override
            public void run(){
                    while(true){
                        try{
                            Thread.sleep(1000);
                        }catch (InterruptedException e){
                            e.printStackTrace();
                        }
                        System.out.println("1:"+Thread.currentThread().getName());
                        System.out.println("2:"+this.getName());
                    }
            }
        };
        thread1.start();

        Thread thread2 = new Thread(() -> {

                while(true){
                    try{
                        Thread.sleep(1000);
                    }catch (InterruptedException e){
                        e.printStackTrace();
                    }
                    System.out.println("3:"+Thread.currentThread().getName());
                }
            }
        );
        thread2.start();
    }
}
